<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
</head>
<body>
	<div class="panel admin-panel">
	  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>新闻内容</strong></div>
	  <div class="body-content">
	    <form method="post" enctype="multipart/form-data" id="addFrom" class="form-x" action="/updateHomeNews.html">  
	      <input type="hidden" name="id" value="${homeNews.id}">
	      <div class="form-group">
	        <div class="label">
	          <label>标题：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input w50" name="title" value="${homeNews.title}" data-validate="required:请输入标题" />
	          <div class="tips"></div>
	        </div>
	      </div>
	      <#if homeNews.image??>
	      <div class="form-group">
	        <div class="label">
	          <label>目录图片：</label>
	        </div>
	        <div class="field">
	        	<img src="${homeNews.getRealImageUrl()}">
	          	<input type="hidden" name="image" value="${homeNews.image}">
	          <div class="tips"></div>
	        </div>
	      </div>
	      </#if>
	      <div class="form-group">
	        <div class="label">
	          <label>描述：</label>
	        </div>
	        <div class="field">
	        	<textarea id="editor_id" style="width:900px;height:500px;">${homeNews.content}</textarea>
	          	<script charset="utf-8" src="/kindeditor/kindeditor.js"></script>
	  			<script charset="utf-8" src="/kindeditor/lang/zh_CN.js"></script>
	          	<input type="hidden" class="input" name="content" id="content">
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label></label>
	        </div>
	        <div class="field">
	          <button id="updateFrom" class="button bg-main icon-check-square-o" type="submit"> 提交</button>
	        </div>
	      </div>
	    </form>
	  </div>
	</div>
<script>
	KindEditor.ready(function(K) {
	    editor = K.create('#editor_id', {
	   	//指定上传文件参数名称
	 		filePostName  : "uploadFile",
	 		//指定上传文件请求的url。
	 		uploadJson : 'pic/upload',
	 		//上传类型，分别为image、flash、media、file
	 		dir : "image"
	     });
	  });
	$(function(){
		$('#updateFrom').click(function(){
			alert(editor.html())
			$('#content').val(editor.html());
			$('#addFrom').submit();
			alert('修改成功');
		})
	})
</script>
</body>
</html>